require "core"

class Role < ActiveRecord::Base  
  include LockDown::Core::SystemObjects
  include LockDown::Core::UserGroups
  
  has_and_belongs_to_many :system_objects
  has_many :user_groups
  
  #
  # Defines methods for your roles such as Role.admin
  #
  class << self
    LockDown::ROLES.each do |key,value|
      define_method(key) { find(value) } unless method_defined?(key)
    end
  end
  
end